<?php $view->extend('template', 'content', array('title' => $view->lang->get('donation')->get('donations')))?>


<?php $i = 0; foreach($donations as $donation): $i++;?>




<div class="col c4">
<h2><?php echo $donation->getName();?></h2>




<div class="row">

<div class="col c2">
	<ul class="menu">
		<li><a href="#"><?php echo $view->lang->get('donation')->get('price')?>: <?php echo $donation->getPrice()?> <?php echo $donation->getCurrency()?></a></li>
	</ul>
</div>
<div class="col c2">

<?php if (!$user): ?>
<div class="message info">
	<p><a href="<?php echo $view->url->linkTo('Auth','login')?>"><?php echo $view->lang->get('donation')->get('login_to_donate')?></a></p>
</div>
<?php else: ?>
<form name="_xclick" action="https://<?php if ($view->getConfig('donation','sandbox_enabled')){echo "www.sandbox.paypal.com";}else{echo "www.paypal.com";} ?>/cgi-bin/webscr" method="post">
	<p>
		<select name="custom">
			<option value="-1" selected="selected"><?php echo $view->lang->get('donation')->get('character')?> ...</option>
			<?php foreach($realms as $realm):?>
				<optgroup label="<?php echo $realm->name; ?>">
					<?php foreach($charRealm[$realm->id] as $id => $name):?>
						<option value="<?php echo $user->getID()?>,<?php echo $realm->id?>,<?php echo $id; ?>"><?php echo $name?></option>
					<?php endforeach;?>
				</optgroup>
			<?php endforeach; ?>
		</select>
	</p>
	<p>
	<input type="hidden" name="cmd" value="_xclick" />
	<input type="hidden" name="item_number" value="<?php echo $donation->getID();?>" />
	<input type="hidden" name="business" value="<?php echo $donconfig['receiver_email']?>" />
	<input type="hidden" name="currency_code" value="<?php echo $donation->getCurrency()?>" />
	<input type="hidden" name="item_name" value="<?php echo $donation->getName();?>" />
	<input type="hidden" name="amount" value="<?php echo $donation->getPrice();?>" />
	<input type="hidden" name="return" value="<?php echo (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] ? 'https' : 'http').'://' . $_SERVER['HTTP_HOST'] . $view->url->linkTo('Donation','thanks')?>" />
	<input type="hidden" name="notify_url" value="<?php echo (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] ? 'https' : 'http').'://' . $_SERVER['HTTP_HOST'] . $view->url->linkTo('PayPalController', 'index');?>"  />
	<input type="image" src="http://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!" />
	</p>
</form>

<?php endif;?>
</div>


</div>

<div class="row">
<div class="col c2">
	<?php $items = $donation->getItemsAsDisplayArray($realms[0]->id);?>
	<?php if (count($items) > 0): ?>
		<h3><?php echo $view->lang->get('donation')->get('items')?></h3>
		<ul class="menu">
		<?php foreach($items as $id => $info): ?>
			<li><?php echo $info['amount']?> x <a href="http://us.battle.net/wow/en/item/<?php echo $id;?>"><?php echo $info['name']?></a></li>
		<?php endforeach; ?>
		</ul>
	<?php endif; ?>
	<?php if ($donation->getMoney()):?>
		<h3><?php echo $view->lang->get('donation')->get('gold')?></h3>
		<ul class="menu">
		<li><a href="#"><?php echo $donation->getMoney() / 100 / 100; ?></a></li>
		</ul>
	<?php endif;?>
</div>

<div class="col c2">
<p><?php echo $donation->getMessage();?></p>
</div>


</div>


</div>

<?php if ($i == 3) echo '</div><div class="row">';?>

<?php endforeach; ?>


